/**
 * Created by hcadmin on 16/3/10.
 */
define([
    "jquery",
    "IO",
    "bootbox"
], function($,IO,bootbox) {
    $(function () {
        var grid;
        var check_id;

        //每列数据列性
        var columns = [
            {
                title: '申请人姓名',
                dataIndex: 'name',
                dataSource: function (data, datarow, gridobj, current_column) {
                    return "<span>" + data[datarow].user_name + "</span>";
                }
            },
            {
                title: '用户id',
                dataIndex: 'name',
                dataSource: function (data, datarow, gridobj, current_column) {
                    return "<span>" + data[datarow].user_id + "</span>";
                }
            },
            {
                title: '专业',
                dataIndex: 'course_name',
                dataSource: function (data, datarow, gridobj, current_column) {
                    return "<span>" + data[datarow].major_name + "</span>";
                }
            },
            {
                title: '申请时间',
                dataIndex: 'create_date',
                dataSource: function (data, datarow, gridobj, current_column) {
                    return "<span>" + data[datarow].create_date + "</span>";
                }
            },
            {
                title: '成绩',
                dataIndex: 'mark',
                dataSource: function (data, datarow, gridobj, current_column) {
                    return "<span>" + data[datarow].mark + "(考试:"+data[datarow].exam_mark+" 平时:"+data[datarow].lesson_mark+")</span>";
                }
            },

            {
                title: '费用',
                dataIndex: 'name',
                dataSource: function (data, datarow, gridobj, current_column) {
                    return "<span>" + data[datarow].price + "</span>";
                }
            },


            {
                title: 'eMail',
                dataIndex: 'name',
                dataSource: function (data, datarow, gridobj, current_column) {
                    return "<span>" + data[datarow].eMail + "</span>";
                }
            },
            {
                title: '手机号',
                dataIndex: 'name',
                dataSource: function (data, datarow, gridobj, current_column) {
                    return "<span>" + data[datarow].mobile + "</span>";
                }
            },

            {
                title: '操作',
                dataIndex: 'action',
                dataSource: function (data, datarow, gridobj, current_column) {

                    //通过

                        return "<span><a href='/pte/detailrenzheng?id="+data[datarow].id+"' style='color: orange;'>查看详情</a></span>";


                }
            },

        ];


        //数组初始化

        function dataInit() {
            grid = new Grid("/pte/api/renzheng", $("#table_my_toast"), $("#paging_my_toast"), 1, 10, columns, get_input_param(), 10);

            //初始化
            grid.Init();
        }


        //获取输入框内容
        function get_input_param() {
            var user_name = $("#text").val();
            var param="user_name="+user_name+"&status="+$("#status").val();

           // alert(param);
            return param;
        }
        dataInit();
        //查询

        $("#searchid").bind("click", function () {

            dataInit();
        });

    });
});
